<?php
$id = $_GET['id'];
@mysql_connect('localhost', 'root', 'root');
$errno = mysql_errno();
if (mysql_errno()) {
    die("$errno" . mysql_error());
}
mysql_select_db('blog');
mysql_set_charset('utf8');
$sql = "delete from `link` where `id`='$id'";
$res = mysql_query($sql);
if ($res) {
    echo "<script>alert('删除成功');window.location.href='index.php'</script>";
} else {
    echo "<script>alert('删除失败');window.location.href='index.php'</script>";
}

mysql_close();
